//
//  Button_Label.m
//  03-HomeWork
//
//  Created by dllo on 16/7/18.
//  Copyright © 2016年 danming. All rights reserved.
//

#import "Button_Label.h"

@implementation Button_Label
- (instancetype) initWithFrame:(CGRect)frame text:(NSString *)text target:(id)target action:(SEL)action {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViewsWithFrame:frame title:text];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:target action:action];
        [_label addGestureRecognizer:tap];
    }
    return self;
}
- (void)createSubViewsWithFrame:(CGRect)frame
                          title:(NSString *)title {
    _label = [[UILabel alloc] initWithFrame:self.bounds];
    _label.text = title;
    _label.textAlignment = NSTextAlignmentCenter;
    _label.userInteractionEnabled = YES;
    [self addSubview:_label];
}

@end
